package com.cnebula.uas.sso.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.springframework.stereotype.Service;

import com.cnebula.uas.sso.model.IdpAuthCenter;
import com.cnebula.uas.sso.service.IdpAuthCenterService;

@Service
public class IdpAuthCenterServiceImpl implements IdpAuthCenterService {

	private static Map<String, IdpAuthCenter> idpAuthCenters = new HashMap<String, IdpAuthCenter>();

	@PostConstruct
	public void init() {
		IdpAuthCenter idp171800 = new IdpAuthCenter();
		idp171800.authURL = "http://210.47.255.5:8080/calis/CalisHWAuth.php";
		idp171800.loginValidURL = "http://210.47.255.5:8080/calis/GetReaderInfo.php";
		idp171800.code = "171800";

		IdpAuthCenter idp510500 = new IdpAuthCenter();
		idp510500.authURL = "http://opac.lib.szu.edu.cn/opac/calis/idp.aspx";
		idp510500.loginValidURL = "http://210.39.5.9/opac/calis/loginvalidservice.aspx";
		idp510500.code = "510500";
		
		IdpAuthCenter idp211010 = new IdpAuthCenter();
		idp211010.authURL = "http://162.105.138.184:8090/idp/pku?cmd=login";
		idp211010.loginValidURL = "http://162.105.138.184:8090/idp/pku";
		idp211010.code = "211010";
		
		

		idpAuthCenters.put("171800", idp171800);
		idpAuthCenters.put("510500", idp510500);
		idpAuthCenters.put("211010", idp211010);
	}

	public IdpAuthCenter getIdpAuthCenter(String idpCode) {
		IdpAuthCenter authCenter = idpAuthCenters.get(idpCode);

		return authCenter;
	}

}
